package org.zh.home.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {
	public static String date2str(Date date,String pattern){
		return getSimpleDateFormat(pattern).format(date);
	}
	public static Date str2date(String source,String pattern) throws ParseException {
		return getSimpleDateFormat(pattern).parse(source);
	}
	public static SimpleDateFormat getSimpleDateFormat(String pattern) {
		return new SimpleDateFormat(pattern);
	}
}
